/**
 * @param {number[]} nums
 * @return {number}
 */
 var countElements = function(nums) {
  nums.sort((a,b) => a-b)
  let min = nums[0], max = nums[nums.length-1]
  let ans = 0
  for(let x of nums){
    if(x > min && x < max) ans++
  }
  return ans
};